package com.metaverse.backend.enums;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

/**
 *
 * 贡献值根据礼物价值x10计算得出
 *
 */
public enum GiftTypeEnum {


    ZERO("点赞","1",5,1),
    ONE("仙女棒","n1/Dg1905sj1FyoBlQBvmbaDZFBNaKuKZH6zxHkv8Lg5x2cRfrKUTb8gzMs=",-1,100),//- 送出仙女棒礼物
    TWO("能力药丸","28rYzVFNyXEXFC8HI+f/WG+I7a6lfl3OyZZjUS+CVuwCgYZrPrUdytGHu0c=",-1,1000),//- 送出能力药水礼物
    THREE("超能喷射","fJs8HKQ0xlPRixn8JAUiL2gFRiLD9S6IFCFdvZODSnhyo9YN8q7xUuVVyZI=",-1,5200),//- 送出甜甜圈礼物
    FOUR("能量电池","PJ0FFeaDzXUreuUBZH6Hs+b56Jh0tQjrq0bIrrlZmv13GSAL9Q1hf59fjGk=",90,9900),//- 送出能量电池礼物
    FIVE("爱的爆炸","IkkadLfz7O/a5UR45p/OOCCG6ewAWVbsuzR/Z+v1v76CBU+mTG/wPjqdpfg=",-1,19900),//- 送出恶魔炸弹礼物
    SIX("神秘空投","gx7pmjQfhBaDOG2XkWI2peZ66YFWkCWRjZXpTqb23O/epru+sxWyTV/3Ufs=",20,9900),//- 送出神秘空投礼物

//    SIX1("神秘空投","pGLo7HKNk1i4djkicmJXf6iWEyd+pfPBjbsHmd3WcX0Ierm2UdnRR7UINvI=",150,9900),//- 送出神秘空投礼物
    ;



    private final String description;//道具名字
    private final String id;//道具ID
    private final Integer validTime;//过期
    private final Integer score;//贡献

    GiftTypeEnum(String description,String id,Integer validTime,Integer score) {
        this.description = description;
        this.id = id;
        this.validTime = validTime;
        this.score =score;
    }

    public String getDescription() {
        return description;
    }
    public String getId() {
        return id;
    }

    public Integer getScore() {
        return score;
    }

    public Integer getValidTime() {
        return validTime;
    }

    private static Map<String, GiftTypeEnum> TYPE_MAP=new HashMap<>();

//    static {
//        TYPE_MAP = Arrays.stream( GiftTypeEnum.values( ) ).collect( Collectors.toMap(GiftTypeEnum::getId, e -> e ) );
//    }

    public static GiftTypeEnum getType( String id ) {
        if (TYPE_MAP.size()==0){
            TYPE_MAP = Arrays.stream( values( ) ).collect( Collectors.toMap(GiftTypeEnum::getId, e -> e ) );
        }
        return TYPE_MAP.get( id );
    }

}
